package pl.mdziedzic.seleniumtests;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.By;

@RunWith(value = Parameterized.class)
public class BananaScrum extends SeleniumBase {

	private String login;
	
	public BananaScrum(String login) {
		this.login = login;
	}

	@Test
	public void testBscrum() throws Exception {
		driver.get("http://demo.bananascrum.com/session/new");
		insertText(By.id("login"), login);
		insertText(By.id("password"), "dupa1");
		clickElement(By.name("commit"));
		assertEquals("Login failed Type user 'admin' with password 'password'",
				driver.findElement(By.xpath("//*[@id=\"flash\"]")).getText());
	}
	
	@Parameters
	public static Collection<Object[]> data(){
		Object[][] data = new Object[][] {
				{"login1"},
				{"login2"},
				{"login3"}
		};
		
		return Arrays.asList(data);
	}

}
